import Vue from 'vue'
import VueRouter from 'vue-router'

import NotFound from "@/views/notFound/notFound.vue";
import Home from "@/views/home/home.vue";
import Login from "@/views/login/login.vue";
import Test from "@/test.vue";

Vue.use(VueRouter)

// 动态路由
const useGetRouter = [
    {
        path: "/",// 指定路由地址
        component: Home,// 当请求地址与路由地址匹配时，那么会使用组件 Home Test
        redirect: "/workbench",
        children: [
            {
                path: "/workbench", // 工作台
                component: Test,
                name: "工作台",
            },
            {
                path: "/userManage", // 用户管理
                component: Test,
                name: "用户管理",
                redirect: "/userManage/userList",
                children: [
                    {
                        path: "/userManage/userList", // 用户列表
                        component: Test,
                        name: "用户列表",
                    }
                ]
            },
            {
                path: "/appManage", // 应用管理
                component: Test,
                redirect: "/appManage/userRecharge",
                children: [
                    {
                        path: "/appManage/userRecharge", // 用户充值
                        component: Test,
                        name: "用户充值",
                    },
                    {
                        path: "/userManage/article", // 文章资讯
                        component: Test,
                        name: "文章资讯",
                        redirect: "/userManage/article/lists",
                        children: [
                            {
                                path: "/userManage/article/lists", // 文章管理
                                name: "文章管理",
                                component: Test
                            },
                            {
                                path: "/userManage/article/column", // 文章栏目
                                name: "文章栏目",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/userManage/message", // 消息管理
                        component: Test,
                        redirect: "/userManage/message/notice",
                        name: "消息管理",
                        children: [
                            {
                                path: "/userManage/message/notice", // 通知设置
                                name: "通知设置",
                                component: Test
                            },
                            {
                                path: "/userManage/message/short", // 短信设置
                                name: "短信设置",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/userManage/material",  // 素材管理
                        component: Test,
                        name: "素材管理",
                        redirect: "/userManage/material/materialCenter",
                        children: [
                            {
                                path: "/userManage/material/materialCenter", // 素材中心
                                name: "素材中心",
                                component: Test
                            }
                        ]
                    }
                ]
            },
            {
                path: "/finance", // 财务管理
                component: Test,
                name: "财务管理",
                redirect: "/finance/balance_details",
                children: [
                    {
                        path: "/finance/balance_details", // 余额明细
                        name: "余额明细",
                        component: Test
                    },
                    {
                        path: "/finance/recharge_record", // 充值记录
                        name: "充值记录",
                        component: Test
                    },
                    {
                        path: "/finance/refund_record", // 退款记录
                        name: "退款记录",
                        component: Test
                    }
                ]
            },
            {
                path: "/decoration", // 装修管理
                component: Test,
                name: "装修管理",
                redirect: "/decoration/mobile",
                children: [
                    {
                        path: "/decoration/mobile", // 移动端
                        name: "移动端",
                        component: Test,
                        redirect: "/decoration/mobile/pages",
                        children: [
                            {
                                path: "/decoration/mobile/pages", // 页面装修
                                name: "页面装修",
                                component: Test
                            },
                            {
                                path: "/decoration/mobile/tabbar", // 底部导航
                                name: "底部导航",
                                component: Test
                            },
                            {
                                path: "/decoration/mobile/style", // 系统风格
                                name: "系统风格",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/decoration/pc", // PC端
                        component: Test,
                        name: "PC端",
                        redirect: "/decoration/pc/pages",
                        children: [
                            {
                                path: "/decoration/pc/pages", // PC端装修
                                name: "PC端装修",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/decoration/material", // 素材中心
                        name: "PC端素材中心",
                        component: Test
                    }
                ]
            },
            {
                path: "/channel", // 渠道设置
                component: Test,
                name: "渠道设置",
                redirect: "/channel/h5",
                children: [
                    {
                        path: "/channel/h5", // h5设置
                        name: "h5设置",
                        component: Test
                    },
                    {
                        path: "/channel/weapp", // 微信小程序
                        name: "微信小程序",
                        component: Test
                    },
                    {
                        path: "/channel/wx_oa", // 微信公众号
                        component: Test,
                        name: "微信公众号",
                        redirect: "/channel/wx_oa/config",
                        children: [
                            {
                                path: "/channel/wx_oa/config", // 公众号配置
                                name: "公众号配置",
                                component: Test
                            },
                            {
                                path: "/channel/wx_oa/menu", // 菜单管理
                                name: "菜单管理",
                                component: Test
                            },
                            {
                                path: "/channel/wx_oa/menu/follow", // 关注回复
                                name: "关注回复",
                                component: Test
                            },
                            {
                                path: "/channel/wx_oa/menu/keyword", // 关键字回复
                                name: "关键字回复",
                                component: Test
                            },
                            {
                                path: "/channel/wx_oa/menu/default", // 默认回复
                                name: "默认回复",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/channel/open_setting", // 微信开发平台
                        name: "微信开发平台",
                        component: Test
                    }
                ]
            },
            {
                path: "/organization", // 组织管理
                component: Test,
                name: "组织管理",
                redirect: "/organization/department",
                children: [
                    {
                        path: "/organization/department", // 部门管理
                        name: "部门管理",
                        component: Test
                    },
                    {
                        path: "/organization/jobs", // 岗位管理
                        name: "岗位管理",
                        component: Test
                    }
                ]
            },
            {
                path: "/permission", // 权限管理
                name: "权限管理",
                component: Test,
                redirect: "/permission/menu",
                children: [
                    {
                        path: "/permission/menu", // 菜单
                        name: "菜单",
                        component: Test
                    },
                    {
                        path: "/permission/role", // 角色
                        name: "角色",
                        component: Test
                    },
                    {
                        path: "/permission/admin", // 管理员
                        name: "管理员",
                        component: Test
                    }
                ]
            },
            {
                path: "/system", // 系统设置
                component: Test,
                name: "系统设置",
                redirect: "/system/website",
                children: [
                    {
                        path: "/system/website", // 网站设置
                        name: "网站设置",
                        component: Test,
                        redirect: "/system/website/information",
                        children: [
                            {
                                path: "/system/website/information", // 网站信息
                                name: "网站信息",
                                component: Test
                            },
                            {
                                path: "/system/website/filing", // 网站备案
                                name: "网站备案",
                                component: Test
                            },
                            {
                                path: "/system/website/protocol", // 政策协议
                                name: "政策协议",
                                component: Test
                            },
                            {
                                path: "/system/website/statistics", // 站点统计
                                name: "站点统计",
                                component: Test
                            },
                        ]
                    },
                    {
                        path: "/system/user", // 用户设置
                        name: "用户设置1",
                        component: Test,
                        redirect: '/system/user/setup',
                        children: [
                            {
                                path: "/system/user/setup", // 用户设置
                                name: "用户设置",
                                component: Test
                            },
                            {
                                path: "/system/user/login_register", // 登录注册
                                name: "登录注册",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/system/pay", // 支付设置
                        component: Test,
                        name: "支付设置",
                        redirect: '/system/pay/method',
                        children: [
                            {
                                path: "/system/user/method", // 支付方式
                                name: "支付方式",
                                component: Test
                            },
                            {
                                path: "/system/user/config", // 支付配置
                                name: "支付配置",
                                component: Test
                            }
                        ]
                    },
                    {
                        path: "/system/storage", // 存储设置
                        name: "存储设置",
                        component: Test,
                    },
                    {
                        path: "/system/search", // 热门搜索
                        name: "热门搜索",
                        component: Test,
                    },
                    {
                        path: "/system/maintenance", // 系统维护
                        name: "系统维护",
                        component: Test,
                        children: [
                            {
                                path: "/system/user/method", // 支付方式
                                name: "系统支付方式",
                                component: Test
                            },
                            {
                                path: "/system/user/config", // 支付配置
                                name: "系统支付配置",
                                component: Test
                            }
                        ]
                    }
                ]
            }
        ]
    },
]
const staticRoutes = [
    {
        // 支持的请求地址除/newsList以及，还支持/news
        path: "/login",
        name: "登录",
        component: Login
    },
    {
        path: "*",
        name: "NotFound",
        component: NotFound
    }
]
const router = new VueRouter({
    mode: 'history',
    routes: [...useGetRouter, ...staticRoutes]
})

export default router
export {
    useGetRouter
}
